package com.hontech.bread.ui.parts

import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.widget.Button
import android.widget.FrameLayout
import com.hontech.bread.R
import com.hontech.bread.device.leftPushPush
import com.hontech.bread.device.leftPushReset
import com.hontech.bread.ui.dialog.runProg
import com.hontech.bread.utils.onClick
import com.hontech.bread.utils.stringById

class LeftPushMotorParts(context: Context, attrs: AttributeSet) : FrameLayout(context, attrs) {


    init {
        val view = LayoutInflater.from(context).inflate(R.layout.parts_left_push_test, this)
        val reset = view.findViewById<Button>(R.id.id_left_push_btn_reset)
        val push = view.findViewById<Button>(R.id.id_left_push_btn_push)

        reset.onClick {
            runProg(stringById(R.string.t1733460848_418), stringById(R.string.t1733460848_419)) {
                leftPushReset()
            }
        }
        push.onClick {
            runProg(stringById(R.string.t1733460848_420), stringById(R.string.t1733460848_421)) {
                leftPushPush()
            }
        }
    }

}